import {TransferDom, Popup, Tab, TabItem,XDialog} from 'vux'
import {formatDate} from '../../common/date.js';
// import moTicketPanel from "../ticket-panel/ticket.vue"
// import moGoodsItem from '../../../common/components/goods/goods-order-list/goods.vue'

export default {
  name: 'moDialogTicketPanel',
  props: ['data','currentRed'],
  filters: {
    formatDate(time) {
      var date = new Date(time.replace(/-/g, "/"));
      return formatDate(date, 'yyyy.MM.dd hh:mm');
    }
  },
  directives: {
    TransferDom
  },
  components: {
    XDialog,
    Popup,
    Tab,
    TabItem
  },
  data() {
    return {
      itemData: this.data || [],
      isShow: false
    }
  },
  methods: {

    redPacketInit() {
      this.isShow = true;
    },
    //关闭弹窗
    closeInit() {
      this.isShow = false;
    },
    chooseRedPacket(packet){
      if(packet){
        for(var i=0;i<this.itemData.length;i++){
          if(this.itemData[i].id==packet.id){
            this.itemData[i].checked=true;
          }else{
            this.itemData[i].checked=false;
          }
        }
        this.$emit('packet',packet)
      }else{
        for(var i=0;i<this.itemData.length;i++){
          this.itemData[i].checked=false;
        }
        this.$emit('packet')
      }
      this.isShow = false;

    }
  },
  mounted() {


  },
  watch: {
    data(val) {
      this.itemData = val || [];
    }
  }
}

